﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/MedicalDirector/MasterDirect.master"
    AutoEventWireup="true" CodeFile="RoomManagement.aspx.cs" Inherits="Management_MedicalDirector_RoomManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">
        .table
        {
        }
        .table td
        {
            vertical-align: top;
            text-align:left;
        }
    </style>
    <asp:Panel ID="pn1" runat="server" Height="350px">
        <table width="100%" class="table">
            <tr>
                <td>
                    <asp:Panel runat="server" ID="Panel1">
                        <table width="100%">
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label1" runat="server" Text="Danh sách khoa" Font-Size="Larger" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                        DataSourceID="khoaDS" ForeColor="#333333" GridLines="None" Width="400px" ShowHeaderWhenEmpty="True"
                                        DataKeyNames="ID" AllowPaging="True" BorderWidth="1px" BorderColor="Black" HorizontalAlign="Center">
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="Tên Khoa" SortExpression="Name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="Label1" runat="server" Text='<%# Eval("Name") %>' OnClick="ward_onclick"
                                                        CommandArgument='<%# Eval("ID") +"," + Eval("Location") %>' CausesValidation="false"></asp:LinkButton>
                                                </ItemTemplate>
                                                <HeaderStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemStyle Height="15px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Khu" SortExpression="Location">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Location") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Location") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemStyle Height="15px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Số điện thoại" SortExpression="TelExt">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("TelExt") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("TelExt") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemStyle Height="15px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <EditRowStyle BackColor="#999999" />
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="khoaDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                        SelectCommand="SELECT [ID], [Name], [Location], [TelExt] FROM [tbWard] ORDER BY [Name]"
                                        DeleteCommand="DELETE FROM [tbWard] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbWard] ([Name], [Location], [TelExt]) VALUES (@Name, @Location, @TelExt)"
                                        UpdateCommand="UPDATE [tbWard] SET [Name] = @Name, [Location] = @Location, [TelExt] = @TelExt WHERE [ID] = @ID">
                                        <DeleteParameters>
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </DeleteParameters>
                                        <InsertParameters>
                                            <asp:Parameter Name="Name" Type="String" />
                                            <asp:Parameter Name="Location" Type="String" />
                                            <asp:Parameter Name="TelExt" Type="String" />
                                        </InsertParameters>
                                        <UpdateParameters>
                                            <asp:Parameter Name="Name" Type="String" />
                                            <asp:Parameter Name="Location" Type="String" />
                                            <asp:Parameter Name="TelExt" Type="String" />
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </UpdateParameters>
                                    </asp:SqlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label6" runat="server" Text="Thêm khoa" Font-Size="Larger" ForeColor="Green"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle">
                                    <asp:Label ID="Label7" runat="server" Text="Tên khoa"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="tbTenkhoa" runat="server"></asp:TextBox>
                                    <asp:Label ID="lbValiName" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle">
                                    <asp:Label ID="Label9" runat="server" Text="Khu"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="tbLocation" runat="server"></asp:TextBox>
                                    <asp:Label ID="lbValiLocation" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle">
                                    <asp:Label ID="Label8" runat="server" Text="Số điện thoại"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="tbMayle" runat="server"></asp:TextBox>
                                    <asp:Label ID="lbValiTel" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <asp:Button ID="btAddWard" runat="server" Text="Thêm" OnClick="btThem_Click" CausesValidation="False" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
                <td>
                    <asp:Panel runat="server" ID="Panel2" Visible="false">
                        <table width="100%">
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label4" runat="server" Text="Danh sách phòng" Font-Size="Larger" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                        DataSourceID="phongDS" ForeColor="#333333" GridLines="None" Width="250px" DataKeyNames="ID"
                                        ShowHeaderWhenEmpty="True" AllowPaging="True" BorderColor="Black" BorderWidth="1px">
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="Tên Phòng" SortExpression="RoomName">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("RoomName") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="Label1" runat="server" Text='<%# Bind("RoomName") %>' OnClick="btRoom_Click"
                                                        CommandArgument='<%# Eval("ID") +"," +Eval("RoomName") %>' CausesValidation="false"></asp:LinkButton>
                                                </ItemTemplate>
                                                <HeaderStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemStyle Height="15px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                            <asp:CommandField DeleteImageUrl="Hủy" EditText="Sửa" ShowEditButton="True" UpdateText="Cập Nhật">
                                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:CommandField>
                                        </Columns>
                                        <EditRowStyle BackColor="#999999" />
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="phongDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                        SelectCommand="SELECT [IDWard], [RoomName], [ID] FROM [tbRoom] WHERE ([IDWard] = @IDWard)"
                                        DeleteCommand="DELETE FROM [tbRoom] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbRoom] ([IDWard], [RoomName]) VALUES (@IDWard, @RoomName)"
                                        UpdateCommand="UPDATE [tbRoom] SET [RoomName] = @RoomName WHERE [ID] = @ID">
                                        <DeleteParameters>
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </DeleteParameters>
                                        <InsertParameters>
                                            <asp:Parameter Name="IDWard" Type="Int32" />
                                            <asp:Parameter Name="RoomName" Type="String" />
                                        </InsertParameters>
                                        <SelectParameters>
                                            <asp:FormParameter FormField="IDWard" Name="IDWard" Type="Int32" />
                                        </SelectParameters>
                                        <UpdateParameters>
                                            <asp:Parameter Name="IDWard" Type="Int32" />
                                            <asp:Parameter Name="RoomName" Type="String" />
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </UpdateParameters>
                                    </asp:SqlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label10" runat="server" Text="Thêm phòng:" Font-Size="Larger"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle">
                                    <asp:Label ID="Label11" runat="server" Text="Tên phòng"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="tbRoomName" runat="server"></asp:TextBox>
                                    <asp:Label ID="lbValiRoom" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <asp:Button ID="btAddRoom" runat="server" Text="Thêm" OnClick="btAddRoom_Click" CausesValidation="false" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
                <td>
                    <asp:Panel runat="server" ID="Panel3" Visible="false">
                        <table width="100%">
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label5" runat="server" Text="Danh sách giường" Font-Size="Larger"
                                        ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                        DataSourceID="giuongDS" ForeColor="#333333" GridLines="None" Width="250px" ShowHeaderWhenEmpty="True"
                                        DataKeyNames="ID" AllowPaging="True" BorderColor="Black" BorderWidth="1px">
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="Tên giường" SortExpression="BedName">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("BedName") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("BedName") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                <ItemStyle Height="15px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                            <asp:CommandField CancelText="Hủy" EditText="Sửa" ShowEditButton="True" UpdateText="Cập Nhật">
                                            </asp:CommandField>
                                        </Columns>
                                        <EditRowStyle BackColor="#999999" />
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="giuongDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                                        SelectCommand="SELECT [IDRoom], [BedName], [ID] FROM [tbBed] WHERE ([IDRoom] = @IDRoom)"
                                        DeleteCommand="DELETE FROM [tbBed] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbBed] ([IDRoom], [BedName]) VALUES (@IDRoom, @BedName)"
                                        UpdateCommand="UPDATE [tbBed] SET [BedName] = @BedName WHERE [ID] = @ID">
                                        <DeleteParameters>
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </DeleteParameters>
                                        <InsertParameters>
                                            <asp:Parameter Name="IDRoom" Type="Int32" />
                                            <asp:Parameter Name="BedName" Type="String" />
                                        </InsertParameters>
                                        <SelectParameters>
                                            <asp:FormParameter FormField="IDRoom" Name="IDRoom" Type="Int32" />
                                        </SelectParameters>
                                        <UpdateParameters>
                                            <asp:Parameter Name="IDRoom" Type="Int32" />
                                            <asp:Parameter Name="BedName" Type="String" />
                                            <asp:Parameter Name="ID" Type="Int32" />
                                        </UpdateParameters>
                                    </asp:SqlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Label ID="Label12" runat="server" Text="Thêm giường" Font-Size="Larger"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle">
                                    <asp:Label ID="Label13" runat="server" Text="Số giường"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="tbBedName" runat="server"></asp:TextBox>
                                    <asp:Label ID="lbValiBed" runat="server" ForeColor="Red"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <asp:Button ID="btAddBed" runat="server" Text="Thêm" OnClick="btAddBed_Click" CausesValidation="false" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
